<template>
  <div class="box">
    <h2>子组件{{person.name}}</h2>
    从父组件中获取的值:<label for="">{{num}}</label>
    <br>
    <button @click="subNum">值-1</button>
  </div>
</template>
<style lang="css">
  .box{
    border:1px solid #ccc;
    width:200px;
    padding:5px;
    margin: 20px;
  }
</style>
<script>
import { mapMutations, mapState } from "vuex";
export default {
  name: 'SubItem',
  computed: {
    ...mapState(["num",'msg','person']),
  },
  methods:{
    ...mapMutations(['subNum']),
  },
  mounted(){
  }
}
</script>